# 调用循环，用于 rendered 在 0 ~ last_cnt -1 之间的方法

execute as @e[tag=mt_gen] run scoreboard players operation @s mt_index -= rendered mt_index
execute as @e[tag=mt_gen_last] run scoreboard players operation @s mt_index -= rendered mt_index

# 填充
tag @e[tag=mt_gen,scores={mt_index=0}] add mt_surf_fill_in1
tag @e[tag=mt_gen_last,scores={mt_index=0}] add mt_surf_fill_in2

execute as @e[tag=mt_gen_last] run scoreboard players operation @s mt_index += rendered mt_index
tag @e[tag=mt_gen_last,scores={mt_index=0}] add mt_surf_fill_in3
execute as @e[tag=mt_gen_last] run scoreboard players operation @s mt_index -= rendered mt_index

# say ===
# say @e[tag=mt_surf_fill_in1] @e[tag=mt_surf_fill_in2] @e[tag=mt_surf_fill_in3]
function mountain:surf_fill/entry

tag @e[tag=mt_surf_fill_in1] remove mt_surf_fill_in1
tag @e[tag=mt_surf_fill_in2] remove mt_surf_fill_in2
tag @e[tag=mt_surf_fill_in3] remove mt_surf_fill_in3

# 填充
tag @e[tag=mt_gen,scores={mt_index=0}] add mt_surf_fill_in1
execute as @e[tag=mt_gen] run scoreboard players operation @s mt_index += rendered mt_index
execute as @e[tag=mt_gen_last] run scoreboard players operation @s mt_index += rendered mt_index
tag @e[tag=mt_gen,scores={mt_index=0}] add mt_surf_fill_in2
tag @e[tag=mt_gen_last,scores={mt_index=0}] add mt_surf_fill_in3
execute as @e[tag=mt_gen] run scoreboard players operation @s mt_index -= rendered mt_index
execute as @e[tag=mt_gen_last] run scoreboard players operation @s mt_index -= rendered mt_index


# say ---
# say @e[tag=mt_surf_fill_in1] @e[tag=mt_surf_fill_in2] @e[tag=mt_surf_fill_in3]
function mountain:surf_fill/entry

tag @e[tag=mt_surf_fill_in1] remove mt_surf_fill_in1
tag @e[tag=mt_surf_fill_in2] remove mt_surf_fill_in2
tag @e[tag=mt_surf_fill_in3] remove mt_surf_fill_in3

execute as @e[tag=mt_gen] run scoreboard players operation @s mt_index += rendered mt_index
execute as @e[tag=mt_gen_last] run scoreboard players operation @s mt_index += rendered mt_index
scoreboard players add rendered mt_index 1

schedule function mountain:gen/gen_next_async_callback 1s